package homework.api03;

import java.util.ArrayList;
import java.util.List;

public class ListDemo {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("赵丽颖");
        list.add("范冰冰");
        list.add("鞠婧祎");
        list.add("今晨");
        System.out.println("追加元素："+ list);
        list.add(1,"范丞丞");
        System.out.println("插入元素："+list);
        System.out.println("list:"+list);
        list.remove("范冰冰");
        System.out.println("删除指定元素："+list);
        list.remove(0);
        System.out.println("删除指定索引元素："+list);
        System.out.println("获取元素："+list.get(0));
        System.out.println("替换指定位置元素并返回："+list.set(0,"孙千"));
        System.out.println(list.remove(1));
        System.out.println(list);
        System.out.println(list.subList(0,1));
    }
}
